#!/usr/bin/ksh

# If the required link in run level three does not exist
# then add it...
ostype=$(uname)

# Start of HP-UX post remove

if [[ "$ostype" = HP-UX ]]
then
	rm -f /sbin/rc3.d/S900gri_authd
	rm -f /sbin/rc3.d/S900gri_backend
	rm -f /sbin/rc3.d/S900gri_dwriter
	rm -f /sbin/rc2.d/K900gri_authd
	rm -f /sbin/rc2.d/K900gri_backend
	rm -f /sbin/rc2.d/K900gri_dwriter
	rm -f /sbin/rc1.d/K900gri_authd
	rm -f /sbin/rc1.d/K900gri_backend
	rm -f /sbin/rc1.d/K900gri_dwriter
	rm -f /etc/rc.config.d/gri_backend.example
fi
# End of HP-UX post remove

# Start of AIX post remove
if [[ "$ostype" = AIX ]]
then
	if [ -a /etc/rc.d/rc2.d/Src.local ]
	then
		z=`/usr/bin/egrep '^/opt/gri_backend/bin/start-gri_backend.aix' /etc/rc.d/rc2.d/Src.local
		if [ -n "$z" ]
		then
			egrep -v '^/opt/gri_backend/bin/start-gri_backend.aix' \
				/etc/rc.d/rc2.d/Src.local >/etc/rc.d/rc2.d/Src.local.new
			if [ $? -eq 0 ]
			then
				/usr/bin/mv -f /etc/rc.d/rc2.d/Src.local.new /etc/rc.d/rc2.d/Src.local
				/usr/bin/chmod 550 /etc/rc.d/rc2.d/Src.local
				/usr/bin/chown root.system /etc/rc.d/rc2.d/Src.local
			fi
		fi
	fi

	if [ -a /etc/rc.d/rc2.d/Krc.local ]
	then
		z=`/usr/bin/egrep '^/opt/gri_backend/bin/stop-gri_backend.aix' /etc/rc.d/rc2.d/Krc.local
		if [ -n "$z" ]
		then
			egrep -v '^/opt/gri_backend/bin/stop-gri_backend.aix' \
				/etc/rc.d/rc2.d/Krc.local >/etc/rc.d/rc2.d/Krc.local.new
			if [ $? -eq 0 ]
			then
				/usr/bin/mv -f /etc/rc.d/rc2.d/Krc.local.new /etc/rc.d/rc2.d/Krc.local
				/usr/bin/chmod 550 /etc/rc.d/rc2.d/Krc.local
				/usr/bin/chown root.system /etc/rc.d/rc2.d/Krc.local
			fi
		fi
	fi
fi

# End of AIX post remove

exit 0
